package Long.Lu.Dao;


import Long.Lu.pojo.Employee;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface EmployeeDao extends JpaRepository<Employee,Integer> {
    //批量删除用户
    @Transactional
    @Modifying(clearAutomatically = true)
    //@Query 定义sql的注解。nativeQuery = true 表示定义是sql语句，false 是定HQL语句
    @Query(value="delete  from employee  where employ_id in(:employIds)",nativeQuery = true)
    void deleteAll(@Param("employIds") List<String> employIds);

    //根据员工查询
    Page<Employee> findByeName(String eName, Pageable pageable);

}
